package com.lych.server.controller;

import com.lych.server.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/baidu")
public class BaiduController {
    @Autowired
    private BaiduService baiduService;

    /**
     * 更新位置
     * @param map
     * @return
     */
    @PostMapping("/location")
    public ResponseEntity location(@RequestBody Map map){
        Double longitude = Double.valueOf(map.get("longitude").toString());
        Double latitude = Double.valueOf(map.get("latitude").toString());
        String addrStr = map.get("addrStr").toString();
        baiduService.location(longitude,latitude,addrStr);
        return ResponseEntity.ok(null);

    }
}
